package com.zzx.demo.main;

import java.net.MalformedURLException;

import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;

import com.zzx.api.IDemoService;
import com.zzx.demo.service.ITestService;

public class TestMain {

	public static void main(String[] args) throws MalformedURLException {
		System.err.println("*******main start********");
		Service srvcModel = new ObjectServiceFactory().create(IDemoService.class);
		XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		String URL = "http://localhost:8080/test-xfire/demoService";
		IDemoService ds = (IDemoService) factory.create(srvcModel,URL);
		String str = ds.rtnTest("张三");
		System.err.println("*******第二个服务********");
		Service srvcModel2 = new ObjectServiceFactory().create(ITestService.class);
		String URL2 = "http://localhost:8080/test-xfire/testService";
		XFireProxyFactory factory2 = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		ITestService ts = (ITestService) factory2.create(srvcModel2,URL2);
		String str2 = ts.testModel("啊啊啊啊啊");
		System.err.println("*******第y个服务********"+str);
		System.err.println("*******main end********"+str2);
	}

}
